package edu.uoc.tdp.pac3.beans;

import java.util.Date;

/**
 * Classe que representa un usuari
 * 
 * @author Eloi Rebollo i Francesc Cabrera
 * @version 1.0
 */
public class User implements java.io.Serializable{

    private Integer idUser;
    private String nameUser;
    private Date creationDate;

    public User(Integer idUser, String nameUser, Date creationDate) {
        this.idUser = idUser;
        this.nameUser = nameUser;
        this.creationDate = creationDate;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Integer getIdUser() {
        return idUser;
    }

    public void setIdUser(Integer idUser) {
        this.idUser = idUser;
    }

    public String getNameUser() {
        return nameUser;
    }

    public void setNameUser(String nameUser) {
        this.nameUser = nameUser;
    }
    
    public boolean equals(Object obj) {
        boolean igual = false;
        if (obj != null) {
            if (obj instanceof User) {
                igual = this.getIdUser().equals(((User) obj).getIdUser());
            }
        }
        return igual;
    }

    @Override
    public String toString() {
        StringBuffer cadena = new StringBuffer();
        
        cadena.append(getIdUser().toString() + "\t");
        cadena.append(getNameUser() + "\t");
        cadena.append(getCreationDate().toString() + "\t");
        
        return cadena.toString();
    }
    
}
